// import Vue from 'vue'
import axios from 'axios';
import { VueAxios } from './axios';

const service = axios.create({
	baseURL: `http://39.105.228.41:8085`,
	// baseURL: `http://8.131.77.209:9001/doctor/api/doctor/bigScreen`
});

service.interceptors.response.use((res) => {
	const { status, statusText, data } = res;
	if (status === 200 || !status) {
		switch (data.code) {
			case 0:
				return data.data;
			case 200:
				return data.data;
			case 1000:
				// alert("当前时间段无数据！")
				return;
			default:
				return;
		}
	}
	alert('错误' + statusText);
	return Promise.reject();
});

const installer = {
	vm: {},
	install(Vue) {
		Vue.use(VueAxios, service);
	},
};

export { installer as VueAxios, service as axios };
